package cnblogs.hardfood;

import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;

public class EventListener implements Listener {
    @EventHandler
    public void OnMove(PlayerMoveEvent e){
        if(e.getFrom().getChunk()!=e.getTo().getChunk()) {
            int food=e.getPlayer().getFoodLevel();
            if(food>0){
                e.getPlayer().setFoodLevel(food-1);
            }
        }
    }
}
